package com.zejson.service;

import com.zejson.entity.TruckTeamExample;
import com.zejson.service.base.BasicService;
import com.zejson.service.inf.GeneralServiceInf;
import com.zejson.util.Capitalize;
import com.zejson.util.Page;
import org.springframework.stereotype.Service;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.List;

@Service
public class TruckTeamService extends BasicService implements GeneralServiceInf{

    @Override
    public List<Object> getList() throws ClassNotFoundException {
        TruckTeamExample truckTeamExample = new TruckTeamExample();
        TruckTeamExample.Criteria criteria = truckTeamExample.createCriteria();
        criteria.andTeamidIsNotNull();
        return super.getGeneralDao().selectByExample("TruckTeamMapper", truckTeamExample);
    }

    @SuppressWarnings("all")
    @Override
    public List<Object> getByProperty(String property, Object value) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, ClassNotFoundException {
        TruckTeamExample truckTeamExample = new TruckTeamExample();
        TruckTeamExample.Criteria criteria = truckTeamExample.createCriteria();
        String propertyName = Capitalize.CapitalizeString(property);
        Class[] paramsType = new Class[1];
        paramsType[0] = String.class;
        Method method = criteria.getClass().getMethod("and" + propertyName + "Like", paramsType);
        Object[] params = new Object[1];
        params[0] = value;
        method.invoke(criteria, params);
        return super.getGeneralDao().selectByExample("TruckTeamMapper", truckTeamExample);
    }
}